<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增安全摘要')" />
    <th:block th:include="include :: tinymce"/>

</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-content-add">
            <input name="kind" class="form-control" type="hidden" value="SAFE">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">标题：</label>
                <div class="col-sm-8">
                    <textarea name="title" class="form-control" placeholder="摘要标题"></textarea>
                </div>
            </div>

            <div class="form-group">    
                <label class="col-sm-3 control-label">内容：</label>
                <div class="col-sm-8">
                    <textarea class="summernote" id="content" name="content" ></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">排序：</label>
                <div class="col-sm-8">
                    <input name="idx" class="form-control" type="number" value="99">
                </div>
            </div>

        </form>

        <div class="box-footer">
            <div class="col-sm-offset-5 col-sm-6">
                <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
                <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
            </div>
        </div>
    </div>


    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "news/content"
        $("#form-content-add").validate({
            rules: {
                title: "required",
                idx: "required"
            },
            messages: {
                title:  "必填项",
                idx:  "必填项"
            }
        });

        function submitHandler() {
            $('#content').val(tinyMCE.get('content').getContent())

            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/add", $('#form-content-add').serialize());
            }
        }

        initTinyMec('#content')
    </script>
</body>
</html>